module TrackChanges
  class CurrentUserFilter #:nodoc:
    def self.filter(controller)
      controller.send(:__track_changes_to_models).each do |model|
        instance = controller.instance_variable_get("@#{model}")
        return if instance.nil?

        instance.current_user = controller.send(:current_user)
      end
    end
  end
end
